//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
let extension = {
  components: {//动态扩充组件或组件路径
      //表单header、content、footer对应位置扩充的组件
      gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
      gridBody: '',
      gridFooter: '',
      //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
      modelHeader: '',
      modelBody: '',
      modelFooter: ''
  },
  buttons: { view: [], box: [], detail: [] },//扩展的按钮
  methods: {//事件扩展
      onInit () {
        this.ck = false
        this.searchFormFileds.date_time = [this.getStartDate(), this.getEndDate()]
        this.const.PAGE = 'getPageDataSum' 
        this.const.EXPORT = 'GetPageDataSumExport'
      },
      destroyed () {
        this.const.EXPORT = 'Export'
        this.const.PAGE = 'getPageData'
      },
      exportBefore (param) {
        param.order = "desc"
        param.page = 1
        param.rows = 30
        param.sort = "name"
        return true;
      },
      getStartDate(dates) {
        var dd = new Date();
        var n = dates || 0;
        dd.setDate(dd.getDate() + n);
        var y = dd.getFullYear();
        var m = dd.getMonth() + 1;
        var d = dd.getDate() - 1;
        m = m < 10 ? "0" + m : m;
        d = d < 10 ? "0" + d : d;
        var day = y + "-" + m + "-" + d + " 00:00:00";
        return day;
      },
      getEndDate(dates) {
        var dd = new Date();
        var n = dates || 0;
        dd.setDate(dd.getDate() + n);
        var y = dd.getFullYear();
        var m = dd.getMonth() + 1;
        var d = dd.getDate() - 1;
        m = m < 10 ? "0" + m : m;
        d = d < 10 ? "0" + d : d;
        var day = y + "-" + m + "-" + d + " 23:59:59";
        return day;
      }
  }
};
export default extension;